package com.zhisheng.weekdaytest.mapper;


import com.zhisheng.weekdaytest.entry.MyAvg;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CDTMapper {


    @Select("SELECT \n" +
            "    city_name,\n" +
            "    DATE_FORMAT(date, '%Y-%m') AS month,\n" +
            "    ROUND(AVG(temperature), 2) AS avg_temperature\n" +
            "FROM\n" +
            "    city_daily_temperature\n" +
            "GROUP BY\n" +
            "    city_name, DATE_FORMAT(date, '%Y-%m');")
    List<MyAvg> findAvgByGroupName();
}
